#include "ACUAS/ACUAS.h"
#include "ACUAS/ACUASlcd.h"

//test

//test2


//Read data
//Convert data
//Output data to LCD

PROGRAM_INIT
//calibrate sensor 
//display mV value when flat on table
//take values at 45
//take values at 90
//interpolate the rest 
	
	VAR16(x)	//mV value from accelerometer for axis x	
	VAR16(y)	//mV value from accelerometer for axis y

	ACTIVATE_LCD				//Enable LCD and provide user with initial instructions
	LCD_XY(1,1)
	LCD_TEXT("To Calibrate")
	LCD_XY(1,2)
	LCD_TEXT("Use Joystick Up")

	WAIT_FOR_BUTTON(7){
		CLEAR_LCD				//clear screen and calibrate display to zero degrees for x and y axis	
	}

	ACTIVATE_ADC	//Enable the analog to digital converter

PROGRAM_START
		
		ADC_CHANNEL(1)	//ADC channel 1 used for x axis	conversion
		ADCONVERT_MV(x)

		ADC_CHANNEL(2)	//ADC channel 2 used for y axis conversion
		ADCONVERT_MV(y)
	
		LCD_XY(1,4)
		LCD_TEXT(" ")
		
		LCD_XY(2,4)
		LCD_TEXT(" ")				

		LCD_XY(1,1)
		LCD_NUMBER(x)
		
		LCD_XY(1,2)
		LCD_NUMBER(y)	

PROGRAM_END
